Predefined Constants

Predefined Constants

There are some Constants defined to help using the Commands:

Scribus Version:

The script interface provides two variables containing the current Scribus version in the scribus module. Scripts can use these variables to check that they're running under the version of Scribus they expect, and to report information about incompatibilities to the user. These two variables, scribus_version and scribus_version_info, were added in 1.2.1 and 1.3.0cvs and will not be present in earlier versions. If you need to, you can check for their presence with hasattr(scribus, 'scribus_version').

scribus_version contains the current Scribus version as a string. It will usually look like '1.2.1cvs' or '1.3.0', for example, but is not guaranteed to always follow that format. This variable is useful when you need to display the version to the user, for example when reporting an incompatibility. Do not parse or compare this variable, that is what scribus_version_info is for.

scribus_version_info is a tuple similar to the sys.version_info tuple provided by Python. It is a tuple of the form (majorversion, minorversion, patchlevel, extraversion, build) for example, 1.2.1cvs will have (1,2,1,'cvs',0) and 1.3.2 will have (1,3,2,'',0) . These tuples are ideal for checking for minimum versions, etc, because Python compares tuples element-by-element, left-to-right. For example:

if scribus.scribus_version_info[:3] < (1,2,2):
    messageBox("Scribus - Python script",
        "This script requires Scribus 1.2.2 or newer. "+\
        "You're running %s." % scribus.scribus_version,
        ICON_CRITICAL)
    sys.exit()

Unit Enumeration Constants:

UNIT_POINTS
Measurement Unit Point = 0
UNIT_MILLIMETERS
Measurement Unit Millimeter = 1
UNIT_INCHES
Measurement Unit Inch = 2
UNIT_PICAS
Measurement Unit Pica = 3

Unit Conversion Constants

These conversion factors can be used to convert units to and from points. Thus, to convert inches to points, you can simply write 'value/inch', to convert points to inches you write 'value*inch', and to convert inches to mm you write 'value*mm/inch' .

pt
points in 1 pt
inch
inches in 1 pt
p
pica in 1 pt
cm
centimetres in 1 pt
mm
millimetres in 1 pt
...
Other constants will be provided if the Scribus core knows about them.

Page Orientation Definitions:

PORTRAIT
Pageformat Portrait = 0
LANDSCAPE
Pageformat Landscape = 1

Definitions for Page Formats:

PAPER_A0
Paperformat A0 = 2380 x 3368 Points
PAPER_A1
Paperformat A1 = 1684 x 2380 Points
PAPER_A2
Paperformat A2 = 1190 x 1684 Points
PAPER_A3
Paperformat A3 = 842 x 1190 Points
PAPER_A4
Paperformat A4 = 595 x 842 Points
PAPER_A5
Paperformat A5 = 421 x 595 Points
PAPER_A6
Paperformat A6 = 297 x 421 Points
PAPER_A7
Paperformat A7 = 210 x 297 Points
PAPER_A8
Paperformat A8 = 148 x 210 Points
PAPER_A9
Paperformat A9 = 105 x 148 Points
PAPER_B0
Paperformat B0 = 2836 x 4008 Points
PAPER_B1
Paperformat B1 = 2004 x 2836 Points
PAPER_B2
Paperformat B2 = 1418 x 2004 Points
PAPER_B3
Paperformat B3 = 1002 x 1418 Points
PAPER_B4
Paperformat B4 = 709 x 1002 Points
PAPER_B5
Paperformat B5 = 501 x 709 Points
PAPER_B6
Paperformat B6 = 355 x 501 Points
PAPER_B7
Paperformat B7 = 250 x 355 Points
PAPER_B8
Paperformat B8 = 178 x 250 Points
PAPER_B9
Paperformat B9 = 125 x 178 Points
PAPER_B10
Paperformat B10 = 89 x 125 Points
PAPER_C5E
Paperformat C5E = 462 x 649 Points
PAPER_COMM10E
Paperformat Comm10E = 298 x 683 Points
PAPER_DLE
Paperformat DLE = 312 x 624 Points
PAPER_EXECUTIVE
Paperformat Executive = 542 x 720 Points
PAPER_FOLIO
Paperformat Folio = 595 x 935 Points
PAPER_LEDGER
Paperformat Ledger = 1224 x 792 Points
PAPER_LEGAL
Paperformat Legal = 612 x 1008 Points
PAPER_LETTER
Paperformat Letter = 612 x 792 Points
PAPER_TABLOID
Paperformat Tabloid = 792 x 1224 Points

Definitions for Document Layout:

FACINGPAGES
Layout with facing Pages.
NOFACINGPAGES
Normal Layout of the Document.
FIRSTPAGELEFT
The first Page of the Document is a left Page.
FIRSTPAGERIGHT
The first Page of the Document is a right Page.

Alignment Definitions

ALIGN_LEFTK
Text is aligned to the Left.
ALIGN_CENTERED
The Text is centered in the Textframe.
ALIGN_RIGHT
The Text is aligned to the Right Side of the Textframe
ALIGN_FORCED
The Text has forced Alignment
ALIGN_BLOCK
The Text has block Alignment

Line related Definitions:

LINE_DASH
LINE_DASHDOT
LINE_DASHDOTDOT
LINE_DOT
LINE_SOLID
JOIN_BEVEL
JOIN_MITTER
JOIN_ROUND
CAP_FLAT
CAP_ROUND
CAP_SQUARE

Fill related Definitions:

FILL_NOG
No gradient, plain color
FILL_HORIZONTALG
FILL_VERTICALG
FILL_DIAGONALG
FILL_CROSSDIAGONALG
FILL_RADIALG

Dialog Buttons

BUTTON_ABORT
BUTTON_CANCEL
BUTTON_IGNORE
BUTTON_NO
BUTTON_NONE
BUTTON_OK
BUTTON_RETRY
BUTTON_YES

Dialog Icons

ICON_CRITICAL
ICON_INFORMATION
ICON_NONE
ICON_WARNING